#ifndef __UART_H__
#define __UART_H__

#include "ref.h"
#include "tool.h"

#define COM2 "/dev/ttySAC1"
#define COM3 "/dev/ttySAC2"
#define COM4 "/dev/ttySAC3"

#define LED_D7 "/sys/kernel/gec_ctrl/led_d7"
#define LED_D8 "/sys/kernel/gec_ctrl/led_d8"
#define LED_D9 "/sys/kernel/gec_ctrl/led_d9"
#define LED_D10 "/sys/kernel/gec_ctrl/led_d10"
#define LED_ALL "/sys/kernel/gec_ctrl/led_all"
#define BEEP "/sys/kernel/gec_ctrl/beep"

typedef struct {
    uint32_t gz;  // 光照
    uint32_t wd;  // 温度
    uint32_t sd;  // 湿度
    uint32_t qy;  // 气压
    uint32_t hb;  // 海拔
} GY39;

bool UART_CtrlBLED(const char *filename, bool onOff);

int32_t UART_InitSerial(const char *file, uint32_t baudrate);

void *UART_GetMQ2(void *arg);
void *UART_GetGY39(void *arg);

#endif
